/******************************************************************************
 * @File name   :      CardConstants.java
 *
 * @Author      :      JIZHANGS
 *
 * @Date        :      Aug 20, 2015
 *
 * @Copyright Notice: 
 * Copyright (c) 2015 Capgemini, Inc. All  Rights Reserved.
 * This software is published under the terms of the Capgemini Software
 * License version 1.0, a copy of which has been included with this
 * distribution in the LICENSE.txt file.
 * 
 * 
 * ----------------------------------------------------------------------------
 * Date                   Who         Version        Comments
 * Aug 20, 2015 9:24:14 AM        JIZHANGS     1.0            Initial Version
 *****************************************************************************/
package com.cap.bts.crmdp.dealer.card.constants;

/**
 *
 */
public final class CardConstants {

    /**
     * @Date : Aug 20, 2015
     */
    public static final String CRMDB = "CRMDB";
    public static final String OUTPUTPATH = "outPutPath";
    private CardConstants() {
    }

    //去校验位的卡号
    public  static String getCardToNum(String cardNum,String prefix,Integer numNum, Integer isCheckedEnable,Integer plusNum) {
        // 去前缀取得计算用card字符串
        String cardStr = cardNum.substring(prefix.length(),cardNum.length());
        if(isCheckedEnable==1){
            cardStr = cardStr.substring(0,cardStr.length()-1);
        }
        StringBuilder sb=new StringBuilder();
        sb.append(prefix);
        sb.append(String.format("%0"+String.valueOf(numNum).toString()+"d",Integer.valueOf(cardStr)+plusNum));
        return sb.toString();
    }
    
    //去校验位的最大卡号
    public  static String getMaxNum(String cardNum,String prefix,Integer numNum) {
        StringBuilder sb=new StringBuilder();
        sb.append(prefix);
        sb.append(String.format("%0"+String.valueOf(numNum).toString()+"d",0).replace("0", "9"));
        return sb.toString();
    }
    

}
